http://forums.qhimm.com/index.php?topic=14363.0


you have to decompress files.

If you open FFX disc on 0x8c000, you will see files' table. First thing:
59 01 00 dd

First: offset to the start of the file (in sectors, up to first 4 bits in 3rd byte)
third: "0" means not compressed, "4" means compressed, "8" means dummy
four (dd): space between the end of file and the end of sector, divided by 8.

With above data you can easily extract all files and unpack them with tool.


59 01 means number of sector. Each sector has 2048 bytes, so you have to multiply pointer (159h) by 2048, and it's start of the file.
As this files has "0" in the next byte (the left one, right is still for pointer), it's not compressed.


------------------
LBA start: 0x8c000
LBA end  : 0x9c000? (till 0xAC800 all zeros - 0xAC800=first data (first sector))
(size 32 sectors (65536 bytes)? 65 sectors (max)?)

#pragma pack(push)  /* push current alignment to stack */
#pragma pack(1)     /* set alignment to 1 byte boundary */


struct FFXLba {
    unsigned int sectorStart:20;
    unsigned int compressed:4; // 0-not compressed, 4-compressed, 8-dummy
    unsigned int paddingDiv8:8:
};

char FFXLba_aligment_test[sizeof(struct FFXLba) == 4? 1 : -1];
#pragma pack(pop)   /* restore original alignment from stack */


Data
0x59,0x01,0x00,0xDD,0x60,0x0A,0x00,0xF9,0x61,0x0A,0x00,0x68,0x65,0x0A,0x00,0xCB,
0x92,0x0A,0x00,0xF1,0xD8,0x0A,0x00,0xBB,0xE6,0x0A,0x00,0x95,0xFC,0x0A,0x00,0xFD,
0x00,0x0B,0x00,0x82,0x05,0x0B,0x00,0x3F,0x0B,0x0B,0x00,0x27,0x1A,0x0B,0x00,0xBF,
0x33,0x0B,0x00,0x14,0xAC,0x0B,0x40,0xF8,0xAD,0x0B,0x80,0x00,0xAD,0x0B,0x00,0x3A,
0xC5,0x0B,0x00,0xE0,0xC6,0x0B,0x00,0x75,0xD3,0x0B,0x00,0x00,0xE2,0x0B,0x00,0x00

